package me.zhengjie.modules.sync;

import com.qiaofang.applet.service.other.domain.CityCompany;
import com.qiaofang.applet.service.other.service.CityCompanyService;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.quartz.service.dto.SyncCommon;
import me.zhengjie.modules.sync.pull.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@Deprecated
public class PullService implements Runnable {

    SyncCommon syncCommon;

    public void setSyncCommon(SyncCommon syncCommon) {
        this.syncCommon = syncCommon;
    }

    @Autowired
    private FirsthandEstateSync firsthandEstateSync;
    @Autowired
    private DeptSync deptSync;
    @Autowired
    private EmpSync empSync;
    @Autowired
    private DistrictSync districtSync;
    @Autowired
    private AreaSync areaSync;
    @Autowired
    private EstateSync estateSync;
    @Autowired
    private EstatePhotoSync estatePhotoSync;
    @Autowired
    private PropertySync propertySync;
    @Autowired
    private ProVideoSync proVideoSync;
    @Autowired
    private ProVrSync proVrSync;
    @Autowired
    private ProContactSync proContactSync;

    @Autowired
    private CityCompanyService cityCompanyService;


    @Override
    public void run() {
        log.info("run companyUuid {} start ",syncCommon.getCompanyUuid());

        //新房
        log.info("run companyUuid {} firsthandEstateSync start ",syncCommon.getCompanyUuid());
        Long startTime=System.currentTimeMillis();
        firsthandEstateSync.pull(syncCommon, null);
        Long endTime=System.currentTimeMillis();
        log.info("run companyUuid {} firsthandEstateSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //部门
        log.info("run companyUuid {} deptSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        deptSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} deptSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //经纪人
        log.info("run companyUuid {} empSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        empSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} empSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //区域
        log.info("run companyUuid {} districtSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        districtSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} districtSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //商圈
        log.info("run companyUuid {} areaSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        areaSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} areaSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //楼盘
        log.info("run companyUuid {} estateSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        estateSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} estateSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //楼盘图片
        log.info("run companyUuid {} estatePhotoSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        estatePhotoSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} estatePhotoSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //视频
        log.info("run companyUuid {} proVideoSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        proVideoSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} proVideoSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //VR
        log.info("run companyUuid {} proVrSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        proVrSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} proVrSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

        //业主
        log.info("run companyUuid {} proContactSync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        proContactSync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} proContactSync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));

       //房源
        log.info("run companyUuid {} propertySync start ",syncCommon.getCompanyUuid());
        startTime=System.currentTimeMillis();
        propertySync.pull(syncCommon, null);
        endTime=System.currentTimeMillis();
        log.info("run companyUuid {} propertySync end {} ",syncCommon.getCompanyUuid(),(endTime-startTime));
    }



}
